import Config from '@/config/index.js'

export const getCookie = () => {
	let cookie = uni.getStorageSync('cookie')
	return cookie
}

export const getScene = (scene = "") => {
	if (scene == "") return {}
	let res = {}
	let params = decodeURIComponent(scene).split("&")
	params.forEach(item => {
	  let pram = item.split("=")
	  res[pram[0]] = pram[1]
	})
	return res
}


/*
	@desc 显示订单状态文字和颜色
	@parma state 订单状态
 */
 /*
	1=发货=Send|
	2=收货=Accept|
	3=退换货发货=RefundSend|
	4=退换货收货=RefundAccept|
	5=门票核销=TicketUse|
	6=电子券核销=CouponUse|
	7=退款退货申请=RefundAudit|
	8=退款退货同意=RefundYes|
	9=退款退货拒绝=RefundNo|
	10=换货申请=ExchangeAudit|
	11=换货同意=ExchangeYes|
	12=换货拒绝=ExchangeNo|
	13=酒店入住=CheckIn|
	14=酒店离店=CheckOut|
	15=支付成功=Pay|						申请退款 | 查看详情
	16=取消订单=Cancel|
	17=下单成功=Add|   					取消订单 | 去付款
	18=评价=Evaluation|
	19=自提订单到货=Arrivals|
	20=无需支付=NoNeedPay
 */
export const orderStateExp = (type, s) => {
	let stateTip = '',
		stateTipColor = '#fa436a';
	switch(+type){
		case 1:
			stateTip = '已发货'; break;
		case 2:
			stateTip = '已完成'; break;
		case 3:
			stateTip = '已发货'; break;
		case 4: 
			stateTip = '已完成'; break;
		case 5:
			stateTip = '已完成'; break;
		case 6: 
			stateTip = '已完成'; break;
		case 7:
			stateTip = '退款申请'; break;
		case 8:
			stateTip = '退款成功'; break;
		case 9:
			stateTip = '申请失败'; break;
		case 10:
			stateTip = '换货申请'; break;
		case 11:
			stateTip = '换货同意'; break;
		case 12:
			stateTip = '换货拒绝';break;
		case 13:
			stateTip = '酒店入住';break;
		case 14:
			stateTip = '酒店离店';break;
		case 15:
			stateTip = s === 2?  '待发货' : '待使用';break;
		case 16:
			stateTip = '已取消';break;
		case 17:
			stateTip = '待付款';break;
		case 18:
			stateTip = '已评价';break;
		case 19:
			stateTip = '';break;
		case 20:
			stateTip = '待使用';break;
		case 21:
		case 25:
			stateTip = '待确认';break;
		//更多自定义
	}
	return {stateTip, stateTipColor};
}
